package com.study.common.result;

import lombok.Data;

import java.io.Serializable;

/**
 * 返回结果
 */
@Data
public class Result implements Serializable {

    private Integer code;

    private String msg;

    private Object data;

    private Long timestamp;

    private Result() {
    }

    public Result(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
        this.data = null;
        this.timestamp = System.currentTimeMillis();
    }

    public Result(ResultEnums enums, Object data) {
        this.code = enums.getCode();
        this.msg = enums.getMsg();
        this.data = data;
        this.timestamp = System.currentTimeMillis();
    }
}
